#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
# @Time    : 2021/3/3 16:20
# @Author  : zhaohexin
# @Email   : 1483643520@xxx.com
# @File    : Depts.py
# @Software: PyCharm
# @FileDescription： 一些通用依赖

from typing import Generator, Optional

from DatabaseOperation.Session import SessionLocal


def get_db() -> Generator:
    """
    获取数据库链接
    :return:
    """
    try:
        db = SessionLocal()
        yield db
    finally:
        db.close()
